#include <stdint.h>

#ifndef __M3DCOLOR_H
#define __M3DCOLOR_H

namespace m3d
{
#pragma pack (push, 1)
	typedef uint16_t SColorI16;
	struct SColorI24;
	struct SColorI32;
	struct SColorF32;
	struct SColorF64;

	// Defines a structure with a value of 8 bits for each color channel
	struct SColorI24 
	{ 
		uint8_t b, g, r;
		SColorI24( const SColorF32& otherColorFloat );
		SColorI24( const SColorI32& otherColorInt );
		SColorI24( const SColorI24& otherColorInt );
		SColorI24( const SColorI16& otherColorInt );
		SColorI24( uint32_t otherColorInt );
		SColorI24( uint8_t r, uint8_t g, uint8_t b );
		bool		operator ==( const SColorF32& )			const;
		bool		operator ==( const SColorI32& )			const;
		bool		operator ==( const SColorI24& )			const;
		bool		operator ==( const SColorI16& )			const;
		bool		operator !=( const SColorF32& )			const;
		bool		operator !=( const SColorI32& )			const;
		bool		operator !=( const SColorI24& )			const;
		bool		operator !=( const SColorI16& )			const;
		SColorI32	operator *( const SColorF32& color )	const;
		SColorI32	operator *( const SColorI32& color )	const;
		SColorI24	operator *( const SColorI24& color )	const;
		SColorF32	operator +( const SColorF32& color )	const;
		SColorI32	operator +( const SColorI32& color )	const;
		SColorI24	operator +( const SColorI24& color )	const;
		SColorI24	operator *( float scalar )				const;
		SColorI24	operator *( double scalar )				const;
		SColorI24	operator /( float scalar )				const;
		SColorI24	operator /( double scalar )				const;
		operator	SColorF32( void )						const;
		operator	SColorI16( void )						const;
		operator	uint32_t( void )						const;
	};

	// Defines a structure with a value of 8 bits for each color channel
	struct SColorI32 
	{ 
		uint8_t b, g, r, a; 
		SColorI32( const SColorF32& otherColorFloat );
		SColorI32( const SColorI32& otherColorBGRA );
		SColorI32( const SColorI24& otherColorBGR );
		SColorI32( uint32_t otherColorBGRA );
		SColorI32( uint8_t r, uint8_t g, uint8_t b, uint8_t a );
		bool		operator ==( const SColorF32& )			const;
		bool		operator ==( const SColorI32& )			const;
		bool		operator ==( const SColorI24& )			const;
		bool		operator !=( const SColorF32& )			const;
		bool		operator !=( const SColorI32& )			const;
		bool		operator !=( const SColorI24& )			const;
		SColorI32	operator *( const SColorF32& color )	const;
		SColorI32	operator *( const SColorI32& color )	const;
		SColorI32	operator *( const SColorI24& color )	const;
		SColorI32	operator +( const SColorF32& color )	const;
		SColorI32	operator +( const SColorI32& color )	const;
		SColorI32	operator +( const SColorI24& color )	const;
		SColorI32	operator *( float scalar )				const;
		SColorI32	operator *( double scalar )				const;
		SColorI32	operator /( float scalar )				const;
		SColorI32	operator /( double scalar )				const;
		operator	SColorF32( void )						const;
		operator	SColorI24( void )						const;
		operator	uint32_t( void )						const;
	};

	// Defines a structure with a floating point value for each color channel
	struct SColorF32 
	{
		float r, g, b, a; 
		SColorF32( void );
		SColorF32( uint16_t Color );
		SColorF32( uint32_t Color );
		SColorF32( const float* rgbaColor );
		SColorF32( const SColorF32& color );
		SColorF32( float _r, float _g, float _b, float _a=1.0f );

		operator uint32_t( void ) const;
		operator const float*( void ) const { return &r; };

		bool operator ==( const SColorF32& color ) const;
		bool operator !=( const SColorF32& color ) const;
		SColorF32& operator =( const SColorF32& color );
		SColorF32& operator +=( const SColorF32& color );
		SColorF32& operator *=( double scalar );
		SColorF32& operator *=( float scalar );
		SColorF32& operator /=( double scalar );
		SColorF32& operator /=( float scalar );
		SColorF32 operator /( float scalar )			const;
		SColorF32 operator /( double scalar )			const;
		SColorF32 operator *( float scalar )			const;
		SColorF32 operator *( double scalar )			const;
		SColorF32 operator *( const SColorF32& color ) const;
		SColorF32 operator +( const SColorF32& color ) const;
//		_GCOLOR operator -( const _GCOLOR& color ) const;
	};

	//
	//struct SColorF64 
	//{ 
	//	double r, g, b, a; 
	//};

#pragma pack (pop)
};


#endif // _M3DCOLOR_H